package com.gton.lpl.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gton.lpl.common.pojo.ThisSystemSign;
import com.gton.lpl.entity.Gplogin;
import com.gton.lpl.mapper.GploginMapper;
import com.gton.lpl.service.GploginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 *
 */
@Service
public class GploginServiceImpl extends ServiceImpl<GploginMapper, Gplogin>
        implements GploginService {

    @Resource
    private GploginMapper gploginMapper;

    /**
     * Description:数据库加密工具类
     */
    @Autowired
    private ThisSystemSign thisSystemSign;

    //根据用户查询登录
    @Override
    public Gplogin queryForEntity(Gplogin gplogin) {
        //数据库的内容依然是加密过的，使用的是mybatis的对称加密方式
        String password = gplogin.getPassword();
        //加密
        String thisUserKey = thisSystemSign.getDataSignByDb(password);
        gplogin.setPassword(thisUserKey);
        return gploginMapper.assertLoginUser(gplogin);
    }
}




